bitkeeper revision 1.1159.1.88 (4124b308xrxOcaDBfOP8TGkxArG9Yg)
authormjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Thu, 19 Aug 2004 14:02:48 +0000 (14:02 +0000)
committermjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Thu, 19 Aug 2004 14:02:48 +0000 (14:02 +0000)
Checking scripts for the things Xen needs for build and install.

14 files changed:
.rootkeys
tools/Makefile
tools/check/Makefile [new file with mode: 0644]
tools/check/README [new file with mode: 0644]
tools/check/check_brctl [new file with mode: 0755]
tools/check/check_curl_devel [new file with mode: 0755]
tools/check/check_curl_lib [new file with mode: 0755]
tools/check/check_logging [new file with mode: 0755]
tools/check/check_python [new file with mode: 0755]
tools/check/check_ssl_lib [new file with mode: 0755]
tools/check/check_twisted [new file with mode: 0755]
tools/check/check_zlib_devel [new file with mode: 0755]
tools/check/check_zlib_lib [new file with mode: 0755]
tools/check/chk [new file with mode: 0755]

index d7ca5387dea9f96687e03627b0daa8b64cd541e2..2a7b97b63d6063f29faf6f3d4dfadea45c617b34 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.7-xen-sparse/mm/page_alloc.c
 40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Make.defs
 3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile
+4124b307nRyK3dhn1hAsvrY76NuV3g tools/check/Makefile
+4124b307vHLUWbfpemVefmaWDcdfag tools/check/README
+4124b307jt7T3CHysgl9LijNHSe1tA tools/check/check_brctl
+4124b307HDX972-zihuZWXB7R8Vd0w tools/check/check_curl_devel
+4124b307P3bZBkTFm6r-3XTbf0phAA tools/check/check_curl_lib
+4124b307u-FeKvFP9kZnh0rLV0XjGg tools/check/check_logging
+4124b307tRTjLqzRy60QrUoqN2Fhuw tools/check/check_python
+4124b307KcYJMtZ7r48AF-wyhyw-SQ tools/check/check_ssl_lib
+4124b307XdznSNCv97lrT3RpOdMM1A tools/check/check_twisted
+4124b307lnAATmulpXYa0M-dzxLBDA tools/check/check_zlib_devel
+4124b308ly20ptMKQoiztPyP_X68Mw tools/check/check_zlib_lib
+4124b308O8yPHMKbj4YPR_grPGZmdA tools/check/chk
 401d7e160vaxMBAUSLSicuZ7AQjJ3w tools/examples/Makefile
 401d7e16UgeqroJQTIhwkrDVkoWgZQ tools/examples/README
 405ff55dawQyCHFEnJ067ChPRoXBBA tools/examples/init.d/xend
index e8cdd966725d6ad7f05dd6cbe78ae6a5739c0fe6..527edab8baa87b8dd7fc0d221c035120367dab1f 100644 (file)
@@ -1,5 +1,6 @@
 
 all:   
+       $(MAKE) -C check
        $(MAKE) -C libxutil
        $(MAKE) -C libxc
        $(MAKE) -C misc
diff --git a/tools/check/Makefile b/tools/check/Makefile
new file mode 100644 (file)
index 0000000..744f098
--- /dev/null
@@ -0,0 +1,16 @@
+
+all: build
+
+# Check this machine is OK for building on.
+build:
+       ./chk build
+
+# Check this machine is OK for installing on.
+# DO NOT use this check from 'make install' in the parent
+# directory, as that target can be used to make an installable
+# copy rather than actually installing.
+install:
+       ./chk install
+
+clean:
+       ./chk clean
\ No newline at end of file
diff --git a/tools/check/README b/tools/check/README
new file mode 100644 (file)
index 0000000..e6f105b
--- /dev/null
@@ -0,0 +1,20 @@
+Checks for the suitability of a machine for Xen build or install.
+To check for build suitability use
+
+        ./chk build
+
+To check for install suitability use
+
+        ./chk install
+
+The chk script will run checks in this directory and print
+the ones that failed. It prints nothing if checks succeed.
+The chk script exits with 0 on success and 1 on failure.
+
+The chk script runs executable files in this directory whose
+names begin with 'check_'. Files containing CHECK-BUILD
+are run for the build check, and files containing CHECK-INSTALL
+are run for the install check.
+
+Detailed output from the check scripts is in .chkbuild for build
+and .chkinstall for install.
\ No newline at end of file
diff --git a/tools/check/check_brctl b/tools/check/check_brctl
new file mode 100755 (executable)
index 0000000..26f3ce6
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+# CHECK-INSTALL
+
+function error {
+   echo 'Check for the bridge control utils (brctl) failed.'
+   exit 1
+}
+
+brctl show || error
\ No newline at end of file
diff --git a/tools/check/check_curl_devel b/tools/check/check_curl_devel
new file mode 100755 (executable)
index 0000000..342ff42
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+# CHECK-BUILD
+
+function error {
+    echo 'Check for libcurl includes failed.'
+    exit 1
+}
+
+set -e
+[ -e /usr/include/curl ] || error
+[ -e /usr/include/curl/curl.h ] || error
\ No newline at end of file
diff --git a/tools/check/check_curl_lib b/tools/check/check_curl_lib
new file mode 100755 (executable)
index 0000000..58b74ed
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+# CHECK-BUILD CHECK-INSTALL
+
+function error {
+        echo 'Check for CURL library failed.'
+        exit 1
+}
+
+set -e
+ldconfig -p | grep libcurl.so || error
\ No newline at end of file
diff --git a/tools/check/check_logging b/tools/check/check_logging
new file mode 100755 (executable)
index 0000000..693454c
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# CHECK-INSTALL
+#  -*- mode: python; -*-
+
+import os
+import sys
+
+def hline():
+    print >>sys.stderr, "*" * 70
+
+def msg(message):
+    print >>sys.stderr, "*" * 3, message
+
+def check_logging():
+    """Check python logging is installed and raise an error if not.
+    Logging is standard from Python 2.3 on.
+    """
+    try:
+        import logging
+    except ImportError:
+        hline()
+        msg("Python logging is not installed.")
+        msg("Use 'make install-logging' at the xen root to install.")
+        msg("")
+        msg("Alternatively download and install from")
+        msg("http://www.red-dove.com/python_logging.html")
+        hline()
+        sys.exit(1)
+
+if __name__ == '__main__':
+    check_logging()
diff --git a/tools/check/check_python b/tools/check/check_python
new file mode 100755 (executable)
index 0000000..321b32d
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+# CHECK-BUILD CHECK-INSTALL
+
+function error {
+    echo "Check for Python version 2.2 or higher failed."
+    exit 1
+}
+
+python -V
+python -V 2>&1 | cut -d ' ' -f 2 | grep -q -E '^2.2|^2.3|^2.4' || error
diff --git a/tools/check/check_ssl_lib b/tools/check/check_ssl_lib
new file mode 100755 (executable)
index 0000000..ecd64d4
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+# CHECK-BUILD CHECK-INSTALL
+
+function error {
+    echo "Check for ssl library failed."
+    exit 1
+}
+
+set -e
+ldconfig -p | grep libssl.so || error
\ No newline at end of file
diff --git a/tools/check/check_twisted b/tools/check/check_twisted
new file mode 100755 (executable)
index 0000000..06d70b4
--- /dev/null
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# CHECK-INSTALL
+#  -*- mode: python; -*-
+
+import os
+import sys
+
+def hline():
+    print >>sys.stderr, "*" * 70
+
+def msg(message):
+    print >>sys.stderr, "*" * 3, message
+
+def check_twisted_version():
+    """Check twisted is installed with a supported version and print a warning if not.
+    Raises an error if twisted is not installed.
+    """
+    # Supported twisted release and major version.
+    RELEASE = 1
+    MAJOR   = 3
+    try:
+        from twisted.copyright import version
+    except ImportError:
+        hline()
+        msg("The Twisted framework is not installed.")
+        msg("Use 'make install-twisted' at the xen root to install.")
+        msg("")
+        msg("Alternatively download and install version %d.%d or higher" % (RELEASE, MAJOR))
+        msg("from http://www.twistedmatrix.com/products")
+        hline()
+        sys.exit(1)
+        
+    (release, major, minor) = version.split('.')
+    release = int(release)
+    major = int(major)
+    if release > RELEASE: return
+    if release == RELEASE and major >= MAJOR: return
+    hline()
+    msg("Warning: Twisted version not supported: %s" % version)
+    msg("Use Twisted version %d.%d.0 or higher" % (RELEASE, MAJOR))
+    hline()
+    sys.exit(1)
+
+if __name__ == '__main__':
+    check_twisted_version()
+
diff --git a/tools/check/check_zlib_devel b/tools/check/check_zlib_devel
new file mode 100755 (executable)
index 0000000..6f6334b
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+# CHECK-BUILD
+
+function error {
+    echo 'Check for zlib includes failed.'
+    exit 1
+}
+
+set -e
+[ -e /usr/include/zlib.h ] || error
\ No newline at end of file
diff --git a/tools/check/check_zlib_lib b/tools/check/check_zlib_lib
new file mode 100755 (executable)
index 0000000..4e19372
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+# CHECK-BUILD CHECK-INSTALL
+
+function error {
+    echo 'Check for zlib library failed.'
+    exit 1
+}
+
+set -e
+ldconfig -p | grep libz.so || error
\ No newline at end of file
diff --git a/tools/check/chk b/tools/check/chk
new file mode 100755 (executable)
index 0000000..632da54
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+function usage {
+    echo "Usage:"
+    echo "\t$0 [build|install|clean]"
+    echo
+    echo "Check suitability for Xen build or install."
+    echo "Exit with 0 if OK, 1 if not."
+    echo "Prints only failed tests."
+    echo
+    echo "Calling with 'clean' removes generated files."
+    exit 1
+}
+
+case $1 in
+    build)
+        check="CHECK-BUILD"
+        info=".chkbuild"
+        ;;
+    install)
+        check="CHECK-INSTALL"
+        info=".chkinstall"
+        ;;
+    clean)
+        rm -f .chkbuild .chkinstall
+        exit 0
+        ;;
+    *)
+        usage
+        ;;
+esac
+
+failed=0
+
+echo "Xen ${check} " $(date) > ${info}
+for f in check_* ; do
+    case $f in
+        *~)
+            continue
+            ;;
+        *)
+            ;;
+    esac
+    if ! [ -x $f ] ; then
+        continue
+    fi
+    if ! grep -q ${check} $f ; then
+        continue
+    fi
+    echo ' ' >> ${info}
+    echo "Checking $f" >> ${info}
+    if ./$f 1>>${info} 2>&1 ; then
+        echo OK >> ${info}
+    else
+        failed=1
+        echo "FAILED $f"
+        echo FAILED >> ${info}
+    fi
+done
+
+echo >> ${info}
+
+if [ "$failed" == "1" ] ; then
+    echo "Checks failed. See ${info} for details."
+    echo "FAILED" >> ${info}
+    exit 1
+else
+    echo "OK" >> ${info}
+    exit 0
+fi
\ No newline at end of file